package com.example.demo.config.service.impl;

import com.example.demo.config.service.RocketMQConsumerService;
import java.time.LocalDateTime;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
import org.springframework.stereotype.Service;

/**
 * @author yongen
 * @description: 消费服务接口抽象实现类
 * @date 2022/2/9 3:09 PM
 */
@Service("rocketMQConsumerService")
@Slf4j
public class AbstarctRocketMQConsumerServiceImpl implements RocketMQConsumerService {

  @Override
  public ConsumeConcurrentlyStatus beforeHandler(String message) {
    log.info("mq消息前置处理: message={}", message);
    return null;
  }

  @Override
  public ConsumeConcurrentlyStatus handle(String message) {
    log.info("mq消息处理业务逻辑");
    return null;
  }

  @Override
  public void afterHandler(String message, LocalDateTime startHandlerTime, ConsumeConcurrentlyStatus status) {
    log.info("mq消息后置处理, message:{}, startHandlerTime:{}, status:{}", message, startHandlerTime, status);
  }
}
